package com.simon.decode;

import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;

import java.util.List;

/**
 * arry to arry 解码
 */
public class ByteArrayDecoder extends MessageToMessageDecoder<ByteBuf> {

    protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf byteBuf, List<Object> list) throws Exception {


       byte[] array=new byte[byteBuf.readableBytes()];
        byteBuf.getBytes(0,array);
        list.add(array);


    }
}
